package cc.mrbird.event.domain;

import cc.mrbird.common.annotation.ExportConfig;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Table(name="event_information")   //事件信息
public class EventInformation implements Serializable {
    //发生地点,发生时间,报警类型,
    private static final long serialVersionUID = 7780821231535881125L;
    @Id
    @GeneratedValue(generator = "JDBC")
    @Column(name = "event_id")
    private Integer event_id;

    @Column(name = "asset_id")
    @ExportConfig(value = "设备id")
    private Integer asset_id;

    @Column(name = "asset_type")
    @ExportConfig(value = "资产类型")
    private String asset_type;

    @Column(name = "event_place")
    @ExportConfig(value = "事件地点")
    private String event_place;

    @Column(name = "event_date")
    @ExportConfig(value = "发生时间",convert = "c:cc.mrbird.common.util.poi.convert.TimeConvert")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date event_date;

    @Column(name = "unit")
    @ExportConfig(value = "所属单位")
    private String unit;

    @Column(name = "eventStatus")
    private Integer eventStatus; //0表示待确认,1表示已确认,2表示已处理

    @ExportConfig(value = "事件状态")
    private String eventStatusStr;

    @Column(name = "camera_information")
    @ExportConfig(value = "摄像头信息")
    private String camera_information;

    @Column(name = "nextTime")
    private String nextTime;   //  用于显示最近时间,以小时、天、周、月为单位

    public Integer getEvent_id() {
        return event_id;
    }

    public void setEvent_id(Integer event_id) {
        this.event_id = event_id;
    }

    public Integer getAsset_id() {
        return asset_id;
    }

    public void setAsset_id(Integer asset_id) {
        this.asset_id = asset_id;
    }

    public String getAsset_type() {
        return asset_type;
    }

    public void setAsset_type(String asset_type) {
        this.asset_type = asset_type;
    }

    public String getEvent_place() {
        return event_place;
    }

    public void setEvent_place(String event_place) {
        this.event_place = event_place;
    }

    public Date getEvent_date() {
        return event_date;
    }

    public void setEvent_date(Date event_date) {
        this.event_date = event_date;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public Integer getEventStatus() {
        return eventStatus;
    }

    public void setEventStatus(Integer eventStatus) {
        this.eventStatus = eventStatus;
    }

    public String getEventStatusStr() {
        if(eventStatus == 0){
            eventStatusStr = "待确认";
        }
        if(eventStatus == 1){
            eventStatusStr = "已确认";
        }
        if(eventStatus == 2){
            eventStatusStr = "已处理";
        }
        return eventStatusStr;
    }

    public void setEventStatusStr(String eventStatusStr) {
        this.eventStatusStr = eventStatusStr;
    }

    public String getNextTime() {
        return nextTime;
    }

    public void setNextTime(String nextTime) {
        this.nextTime = nextTime;
    }

    public String getCamera_information() {
        return camera_information;
    }

    public void setCamera_information(String camera_information) {
        this.camera_information = camera_information;
    }

    @Override
    public String toString() {
        return "EventInformation{" +
                "event_id=" + event_id +
                ", asset_id=" + asset_id +
                ", asset_type='" + asset_type + '\'' +
                ", event_place='" + event_place + '\'' +
                ", event_date=" + event_date +
                ", unit='" + unit + '\'' +
                ", eventStatus=" + eventStatus +
                ", eventStatusStr='" + eventStatusStr + '\'' +
                ", camera_information='" + camera_information + '\'' +
                ", nextTime='" + nextTime + '\'' +
                '}';
    }
}
